package com.fr.report.web.ui.impl.page;

import com.fr.report.js.JavaScriptImpl;
import com.fr.report.web.event.Listener;
import com.fr.report.web.ui.ToolBarButton;
import com.fr.report.web.ui.WebContentUtils;
import com.fr.web.Repository;
import com.fr.web.core.SessionIDInfor;
import com.fr.web.core.ShowWorkBookPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public abstract class TabRelatedToolBarButton extends ToolBarButton
{
  public TabRelatedToolBarButton(String paramString)
  {
    super(paramString);
  }

  public TabRelatedToolBarButton(String paramString1, String paramString2)
  {
    super(paramString1, paramString2);
  }

  public Listener[] createListeners(Repository paramRepository)
  {
    if ("view".equals(paramRepository.getSessionIDInfor().getPolicy().panelType()))
    {
      ArrayList localArrayList = new ArrayList();
      localArrayList.addAll(Arrays.asList(super.createListeners(paramRepository)));
      localArrayList.add(new Listener(WebContentUtils.getContentPanel(paramRepository), "tabchange", new JavaScriptImpl(onTabChange(paramRepository)), false));
      return ((Listener[])localArrayList.toArray(new Listener[localArrayList.size()]));
    }
    return super.createListeners(paramRepository);
  }

  protected abstract String onTabChange(Repository paramRepository);
}